<template>
    <div class="ScreenItemWrap">
        <div class="ScreenItemWrap-title">{{ title }}</div>
        <div class="ScreenItemWrap-contentWrap">
            <div class="ScreenItemWrap-contentWrap-info">
                <template v-if="type == 'box'">
                    <div class="ScreenItemWrap-contentWrap-info-wrap">
                        <a-row class="ScreenItemWrap-contentWrap-info-wrap-row" :gutter="[12, 12]" align="middle"
                            justify="center" type="flex">
                            <a-col v-for="(item, index) in list" :key="item.value + index" :span="8"
                                class="ScreenItemWrap-contentWrap-info-wrap-row-col">
                                <a-row class="ScreenItemWrap-contentWrap-info-wrap-row-col-wrap" :class="item.color"
                                    :gutter="[0, 4]">
                                    <a-col :span="24" class="ScreenItemWrap-contentWrap-info-wrap-row-col-wrap-label">{{
                                        item.label }}</a-col>
                                    <a-col :span="24" class="ScreenItemWrap-contentWrap-info-wrap-row-col-wrap-value">{{
                                        item.value }}</a-col>
                                </a-row>
                            </a-col>
                        </a-row>
                    </div>
                </template>
                <template v-else-if="type == 'bar'">
                    <div class="ScreenItemWrap-contentWrap-info-echartWrap">
                        <ManageEchart :type="type" :setting="item.setting" :data="list">
                        </ManageEchart>
                    </div>
                </template>
                <template v-else-if="type == 'number'">
                    <div class="ScreenItemWrap-contentWrap-info-number">
                        <a-row :gutter="[12, 12]">
                            <a-col :span="24">
                                <div class="ScreenItemWrap-contentWrap-info-number-wrap">
                                    <span class="ScreenItemWrap-contentWrap-info-number-wrap-label">月份</span>
                                    <span class="ScreenItemWrap-contentWrap-info-number-wrap-value">{{ list.name
                                    }}</span>
                                </div>
                            </a-col>
                            <a-col :span="24">
                                <div class="ScreenItemWrap-contentWrap-info-number-wrap">
                                    <span class="ScreenItemWrap-contentWrap-info-number-wrap-label">数量</span>
                                    <span class="ScreenItemWrap-contentWrap-info-number-wrap-value">{{ list.num
                                    }}</span>
                                </div>
                            </a-col>
                        </a-row>
                    </div>
                </template>
                <template v-else-if="type == 'table'">
                    <div class="ScreenItemWrap-table">
                        <TableList :deptid="deptid"></TableList>
                    </div>
                </template>
                <template v-else-if="type == 'list'">
                    <div class="ScreenItemWrap-table">
                        <ListList :deptid="deptid"></ListList>
                    </div>
                </template>
            </div>
        </div>
    </div>
</template>

<script>
import ManageEchart from "@/components/ManageEchart/ManageEchart";
import TableList from './TableList';
import ListList from './ListList';
export default {
    name: 'ScreenItem',
    components: {
        ManageEchart,
        TableList,
        ListList,
    },
    props: {
        title: {
            type: String,
        },
        item: {
            type: Object
        },
        type: {
            type: String,
        },
        list: {
            type: [Object, Array],
        },
        deptid: {
            type: [String, Number],
        }

    },
    data() {
        return {
        }
    },
    mounted() {
    },
    watch: {
    }
}
</script>

<style lang="less" scoped>
.ScreenItemWrap {
    width: 100%;
    height: 100%;
    background: #ffffff;
    box-shadow: 0px 1px 10px 1px #cdcdcd;
    border-radius: 4px;

    &-title {
        padding: 12px;
        font-size: 16px;
        font-weight: bold;
        position: relative;

    }

    &-title::before {
        position: absolute;
        content: '';
        width: 4px;
        height: 40%;
        top: 30%;
        left: 4px;
        background: #035dff;
    }

    &-contentWrap {
        padding: 0px 12px 12px 12px;

        &-info {
            border-top: 1px solid #cdcdcd;

            &-wrap {
                padding: 12px 0px;
                display: flex;
                justify-content: center;
                align-items: center;

                .color1 {
                    background-color: pink;
                    background: linear-gradient(to bottom,
                            #D6EBF9,
                            #EEF9FB);
                }

                .color2 {
                    background-color: pink;
                    background: linear-gradient(to bottom,
                            #D1F5EF,
                            #F2FAFA);
                }

                .color3 {
                    background-color: pink;
                    background: linear-gradient(to bottom,
                            #D0DFFF,
                            #F1F5FE);
                }

                .color4 {
                    background-color: pink;
                    background: linear-gradient(to bottom,
                            #FFECD0,
                            #FFFAF3);
                }

                .color5 {
                    background-color: pink;
                    background: linear-gradient(to bottom,
                            #FFE3DC,
                            #FFF6F4);
                }

                .color6 {
                    background-color: pink;
                    background: linear-gradient(to bottom,
                            #D0F5FF,
                            #F1FCFF);
                }

                &-row {
                    &-col {
                        &-wrap {
                            border-radius: 6px;
                            border: 1px solid #cdcdcd;
                            padding: 8px 8px;
                            font-size: 15px;

                            &-label {
                                text-align: left;
                            }

                            &-value {
                                text-align: left;
                                font-size: 18px;
                                font-weight: 560;
                            }
                        }
                    }
                }
            }

            &-echartWrap {
                height: 35vh;
            }

            &-number {
                padding: 12px;
                font-size: 15px;

                &-wrap {
                    background: #F2F3F7;
                    padding: 12px 24px;
                    display: flex;
                    justify-content: space-between;
                    align-items: center;
                    font-weight: bold;

                    &-label {
                        color: #000000;
                    }

                    &-value {
                        color: #0F70F5;
                    }
                }
            }

        }
    }

    &-table {}
}
</style>